<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'update.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="css/manager.css">

  </head>
  
  <body>
    <h1 style="margin-bottom:0px;">网站文章表单（${article.title}）</h1>
  	<hr style="border:1px dashed #AAA;"/>
  	<input type="button" value="返 回" onclick="history.back();">
  	<input type="button" value="前 进" onclick="history.forward();">
  	<input type="button" value="刷 新" onclick="location.reload();">
  	<div style="display:${error==null?'none':''};width:75%;margin:5px;" class="errorBox">${error}</div>
    <form action="article.do" method="post">
    <input type="hidden" name="method" value="${param.methodName==null?'addArticle':param.methodName}">
    <input type="hidden" name="id" value="${article.id}">
    <ul>
    	<li>
    	文章标题：<br/><input type="text" alt="notNull" name="title" value="${article.title}" style="width:650px;">
    	<br/>29个汉字为最大长度,超出部分在主页会被隐藏起来
    	</li>
    	<li>
    	文章内容：<br/><textarea id="content" rows="20" cols="150" alt="notNull" name="content">${article.content}</textarea>
    	</li>
    	<li>
    	文章来源：<br/><input type="text" alt="notNull" name="comefrom" value="${article.comefrom}"  style="width:200px;">
    	</li>
    	<li>
    	文章作者：<br/><input type="text" alt="notNull" name="author" value="${article.author}"  style="width:200px;">
    	</li>
    	<li>
    	文章类型：<br/>
    	<select name="atype" style="width:200px;">
    		<c:forEach items="${articleType}" var="type">
    			<option value="${type.key}" ${type.key==article.atype?'selected':''}>${type.value}</option>
    		</c:forEach>
    	</select>
    	</li>
    </ul>
    <input type="submit" value="确 定 ">
    </form>
  </body>
  <script type="text/javascript" src="js/javer.js"></script>
  <script type="text/javascript" src="js/validate.js"></script>
  <script language="Javascript" src="htmlbox/jquery-1.3.2.min.js" type="text/javascript"></script>
  <script language="Javascript" src="htmlbox/htmlbox.colors.js" type="text/javascript"></script>
  <script language="Javascript" src="htmlbox/htmlbox.styles.js" type="text/javascript"></script>
  <script language="Javascript" src="htmlbox/htmlbox.syntax.js" type="text/javascript"></script>
  <script language="Javascript" src="htmlbox/xhtml.js" type="text/javascript"></script>
  <script language="Javascript" src="htmlbox/htmlbox.min.js" type="text/javascript"></script>
  <script type="text/javascript">
  	if ('${param.detail}' == '1') {
  		var eles = document.forms[0].elements;
  		for (var i = 0; i < eles.length; i++) {
  			eles[i].setAttribute("disabled", "disabled");
  		}
  	}
  	
  	// 解决冲突($)
  	jQuery.noConflict();
  	
  	// 初始化编辑框
  	jQuery("#content").css("height","100%").css("width","100%").htmlbox({
	    toolbars:[
		    [
			// Cut, Copy, Paste
			//"separator","cut","copy","paste",
			// Undo, Redo
			"separator","undo","redo",
			// Bold, Italic, Underline, Strikethrough, Sup, Sub
			"separator","bold","italic","underline","strike","sup","sub",
			// Left, Right, Center, Justify
			"separator","justify","left","center","right",
			// Ordered List, Unordered List, Indent, Outdent
			"separator","ol","ul","indent","outdent",
			// Hyperlink, Remove Hyperlink, Image
			"separator","link","unlink","image"
			
			],
			[// Show code
			"separator","code",
	        // Formats, Font size, Font family, Font color, Font, Background
	        "separator","formats","fontsize","fontfamily",
			"separator","fontcolor","highlight",
			],
			[
			//Strip tags
			"separator","removeformat","striptags","hr",//"paragraph",
			// Styles, Source code syntax buttons
			"separator","quote","styles","syntax"
			]
		],
		skin:"blue"
	});
  </script>
</html>
